package cn.stylefeng.guns.modular.hxl.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.core.util.DateUtil;
import cn.stylefeng.guns.modular.hxl.entity.VHxlPickDaySorterSum;
import cn.stylefeng.guns.modular.hxl.model.params.HxlAreaParam;
import cn.stylefeng.guns.modular.hxl.model.params.VHxlPickDaySorterSumParam;
import cn.stylefeng.guns.modular.hxl.model.result.HxlAreaResult;
import cn.stylefeng.guns.modular.hxl.service.HxlAreaService;
import cn.stylefeng.guns.modular.hxl.service.VHxlPickDaySorterSumService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import cn.stylefeng.guns.sys.modular.system.service.UserService;
import cn.stylefeng.roses.core.util.ToolUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


/**
 * VIEW控制器
 *
 * @author zhangzh
 * @Date 2025-06-30 17:20:04
 */
@Controller
@RequestMapping("/vHxlPickDaySorterSum")
public class VHxlPickDaySorterSumController extends BaseController {

    private String PREFIX = "/hxl/vHxlPickDaySorterSum";

    @Autowired
    private VHxlPickDaySorterSumService vHxlPickDaySorterSumService;

    @Autowired
    private UserService userService;

    @Autowired
    private HxlAreaService hxlAreaService;

    /**
     * 跳转到主页面
     *
     * @author zhangzh
     * @Date 2025-06-30
     */
    @RequestMapping("")
    public String index(Model model){
    HxlAreaParam param = new HxlAreaParam();
    List<HxlAreaResult> hxlAreaList = hxlAreaService.findListBySpec(param);
        model.addAttribute("hxlAreaList", hxlAreaList);
        return PREFIX + "/vHxlPickDaySorterSum.html";
    }


    /**
     * 查询列表
     *
     * @author zhangzh
     * @Date 2025-06-30
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(VHxlPickDaySorterSumParam vHxlPickDaySorterSumParam,String condition ) {
        return this.vHxlPickDaySorterSumService.findPageBySpec(vHxlPickDaySorterSumParam,condition);
    }


    /**
     * 查询列表
     *
     * @author zhangzh
     * @Date 2025-06-30
     */
    @ResponseBody
    @RequestMapping("/listUser")
    public LayuiPageInfo listUser(VHxlPickDaySorterSumParam vHxlPickDaySorterSumParam) {
        if(ToolUtil.isEmpty(vHxlPickDaySorterSumParam.getStartTime())){
            vHxlPickDaySorterSumParam.setStartTime(DateUtil.getDate());
        }
        if(ToolUtil.isEmpty(vHxlPickDaySorterSumParam.getEndTime())){
            vHxlPickDaySorterSumParam.setEndTime(DateUtil.getDate());
        }
        return this.vHxlPickDaySorterSumService.listUser(vHxlPickDaySorterSumParam);
    }

    /**
     * 查询列表
     *
     * @author zhangzh
     * @Date 2025-06-30
     */
    @ResponseBody
    @RequestMapping("/listWarehouse")
    public LayuiPageInfo listWarehouse(VHxlPickDaySorterSumParam vHxlPickDaySorterSumParam) {
        if(ToolUtil.isEmpty(vHxlPickDaySorterSumParam.getStartTime())){
            vHxlPickDaySorterSumParam.setStartTime(DateUtil.getDate());
        }
        if(ToolUtil.isEmpty(vHxlPickDaySorterSumParam.getEndTime())){
            vHxlPickDaySorterSumParam.setEndTime(DateUtil.getDate());
        }
        return this.vHxlPickDaySorterSumService.listWarehouse(vHxlPickDaySorterSumParam);
    }

}


